package com.max.xihu.patterns.proxy.common;

/**
 * @Author: Max
 * @Date: 2020-09-10 22:52
 * @Description:
 */
public class CoderClient {

    public static void main(String[] args) {
        directReal();
        System.out.println("===========");
        directProxy();
        System.out.println("===========");
        mustProxy();
    }

    public static void directReal(){
        IUser user = new Coder("真实张三");
        user.eat();
        user.work();
        user.sleep();
    }

    public static void directProxy(){
        IUser user = new Coder("张三");
        IUser proxy = new CoderProxy(user);
        proxy.eat();
        proxy.work();
        proxy.sleep();
    }



    public static void mustProxy(){
        IUser user = new Coder("强制代理张三");
        IUser proxy = user.getProxy();
        proxy.eat();
        proxy.work();
        proxy.sleep();
    }
}
